<%@ Page Language="C#" MasterPageFile="~/Masterpages/MasterPage.master" CodeFile="PostAd.aspx.cs"
    Inherits="PostAd_aspx" Title="Post an Ad" meta:resourcekey="PageResource1" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register TagPrefix="uc1" TagName="LocationDropDown" Src="Controls/LocationDropDown.ascx" %>
<%@ Register TagPrefix="uc1" TagName="CategoryPath" Src="Controls/CategoryPath.ascx" %>
<%@ Register src="Controls/CategoryDropDownList.ascx" tagname="CategoryDropDownList" tagprefix="uc2" %>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" Runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <div class="section medium">
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="Please correct the following errors:" CssClass="messageBox error" DisplayMode="BulletList" meta:resourcekey="ValidationSummaryResource1" />

        <div class="messageBox">
            <asp:Label ID="lblMessage" runat="server" Text="" meta:resourcekey="lblMessageResource1"></asp:Label>            
        </div>
        

        <fieldset> 
            <legend><asp:Label ID="lblMandatory" runat="server" Text="Mandatory fields" meta:resourcekey="lblMandatoryResource1"></asp:Label></legend>            
            <ol>
                <li>
                    <uc2:CategoryDropDownList ID="ddlCategories" runat="server" />
                </li>           
                <li>&#160;</li>
                <li>
                    <asp:Label ID="lblAdTypes" runat="server" Text="Type:" 
                        AssociatedControlID="ddlAdTypes" meta:resourcekey="lblTypeResource1"></asp:Label>&#160;<asp:DropDownList 
                        ID="ddlAdTypes" runat="server" meta:resourcekey="ddlAdTypesResource1">
                    </asp:DropDownList>
                </li>

            <li>
            <asp:Label ID="lblTitle" runat="server" Text="Title (50 characters max) : <abbr='required field'>*</abbr>" 
                AssociatedControlID="txtTitle" meta:resourcekey="lblTitleResource1"></asp:Label>&#160;<asp:TextBox 
                ID="txtTitle" runat="server" meta:resourcekey="txtTitleResource1" CssClass="large"></asp:TextBox>
                <em><asp:RequiredFieldValidator ID="TitleRequiredFieldValidator" runat="server" 
                ErrorMessage="Title is mandatory" Text="*" ControlToValidate="txtTitle" 
                meta:resourcekey="TitleRequiredFieldValidatorResource1" Display="Dynamic"></asp:RequiredFieldValidator></em>
            </li>
            
            <li>
            <asp:Label ID="lblDescription" runat="server" 
                Text="Description (500 characters max) : <abbr='required field'>*</abbr>" AssociatedControlID="txtDescription" 
                meta:resourcekey="lblDescriptionResource1"></asp:Label>&#160;<asp:TextBox 
                ID="txtDescription" runat="server" TextMode="MultiLine" Rows="10" Columns="40" 
                meta:resourcekey="txtDescriptionResource1"></asp:TextBox>
                <em><asp:RequiredFieldValidator ID="DescriptionRequiredFieldValidator" 
                runat="server" ErrorMessage="Description is mandatory" Text="*" 
                ControlToValidate="txtDescription" 
                meta:resourcekey="DescriptionRequiredFieldValidatorResource1" Display="Dynamic"></asp:RequiredFieldValidator></em>
            </li>
            
            <li>
                <asp:Label ID="lblPrice" runat="server" Text="Price &euro; : <abbr='required field'>*</abbr>" 
                    AssociatedControlID="txtPrice" meta:resourcekey="lblPriceResource1"></asp:Label>&#160;<asp:TextBox 
                    ID="txtPrice" runat="server" meta:resourcekey="txtPriceResource1" CssClass="small"></asp:TextBox>
                <em><asp:RequiredFieldValidator ID="PriceRequiredFieldValidator" runat="server" 
                    ErrorMessage="Price is mandatory" ControlToValidate="txtPrice" 
                    meta:resourcekey="PriceRequiredFieldValidatorResource1" Display="Dynamic"></asp:RequiredFieldValidator></em>

                <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" 
                    TargetControlID="txtPrice" FilterType="Custom, Numbers" ValidChars="+-=/*().">
                </asp:FilteredTextBoxExtender>
                </li>
            </ol>
    </fieldset>

    <fieldset>
        <legend><asp:Label ID="lblOptional" runat="server" Text="Optional fields" 
                meta:resourcekey="lblOptionalResource1"></asp:Label></legend>

        <ol>
            <li><asp:Label ID="lblUrl" runat="server" Text="URL:" 
            AssociatedControlID="txtUrl" meta:resourcekey="lblUrlResource1"></asp:Label>&#160;<asp:TextBox 
            ID="txtUrl" runat="server" meta:resourcekey="txtUrlResource1"></asp:TextBox>
            </li>
                       
            <li>
            <asp:Label ID="lblFileUploadMessage" runat="server" 
            meta:resourcekey="lblFileUploadMessageResource1"></asp:Label>
            <asp:Label ID="lblFileUpload1" runat="server" Text="Photo 1" 
            AssociatedControlID="FileUpload1" meta:resourcekey="lblFileUpload1Resource1"></asp:Label>&#160;<asp:FileUpload 
            ID="FileUpload1" runat="server" meta:resourcekey="FileUpload1Resource2" />
            <asp:Label ID="lblPreviewImage" runat="server" Text="This image will act as preview image" meta:resourcekey="lblPreviewImageResource1" />
            </li>

            <li>
            <asp:Label ID="lblFileUpload2" runat="server" Text="Photo 2" 
            AssociatedControlID="FileUpload2" meta:resourcekey="lblFileUpload2Resource1"></asp:Label>&#160;<asp:FileUpload 
            ID="FileUpload2" runat="server" meta:resourcekey="FileUpload2Resource2" /></li>

            <li>
            <asp:Label ID="lblFileUpload3" runat="server" Text="Photo 3" 
            AssociatedControlID="FileUpload3" meta:resourcekey="lblFileUpload3Resource1"></asp:Label>&#160;<asp:FileUpload 
            ID="FileUpload3" runat="server" meta:resourcekey="FileUpload3Resource2" /></li>
            
            <li class="buttonBar">
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" meta:resourcekey="btnSubmitResource1" />
            </li>
        </ol>
        
    </fieldset>
    </div>
<script type="text/javascript">
function textCounter(elem, maxLimit) 
{
    if (elem.value.length > maxLimit)
    {
       elem.value = elem.value.substring(0, maxLimit);
    }
} 

</script>    
</asp:Content>

<asp:Content ID="SecondBar" ContentPlaceHolderID="RightContent" runat="server">
            <div class="section small">

                <h3><asp:Label ID="lblHelpTitle" runat="server" Text="Posting a new ad is easy:" meta:resourcekey="lblHelpTitleResource1"></asp:Label></h3>                
                <ol>
                    <li><asp:Label ID="lblHelpText1" runat="server" meta:resourcekey="lblHelpText1Resource1" Text="Select a category"></asp:Label></li>
                    <li><asp:Label ID="lblHelpText2" runat="server" meta:resourcekey="lblHelpText1Resource2" Text="Select an ad type"></asp:Label></li>
                    <li><asp:Label ID="lblHelpText3" runat="server" meta:resourcekey="lblHelpText1Resource3" Text="Fill the title field"></asp:Label></li>
                    <li><asp:Label ID="lblHelpText4" runat="server" meta:resourcekey="lblHelpText1Resource4" Text="Fill the description field"></asp:Label></li>
                </ol>
            </div>
</asp:Content>            

